<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
  :root { font-size: 10px }
  div { font-size: 2rem }
</style>
<div id="rem">2rem</div>
<script>
  test(() => {
    document.documentElement.offsetTop;
    document.documentElement.style.display = "none";
      assert_equals(getComputedStyle(rem).fontSize, "20px");
  }, "Root element set to display:none should not crash updating rem units.");
</script>
